Mood Lamp

I obtained the idea for this project from the list of suggestions given to us as I am not someone who has a background in coding. Enchancing the existing idea, I decided to make the box be able to detect motion - changing colours when nearing OR turning on when nearing. The mood lamp will use 6 LEDs and will have a seperate box to house the motion sensor.

Design:


For week 1, this is my very first sketch of the moodlamp that I wanted to make. (Sorry it is so messy)

For better representation:


The mood lamp will be using 6 LEDs.

Over the weekend, I illustrated a lady with a mushroom over her head using adobe illustrator.

Saving it as an SVG file, I then imported it into fusion to complete before saving it as a DXF file for cutting.

Reference: https://www.pinterest.com/pin/560346378643899875/


Week 2


During week 2, I brought my dxf file to go lazer cut the design engraving. I first did a test run on wood before doing it on acrylic.

This is the settings for the engraving on 5mm acrylic.

Test sample of the settings before cutting,


Week 3

This is the box that I will be printing. It is 15x5x6 cm and has a cut-out fot the motion sensor on the bottom left. The triangular tabs on top will be 3D printed to keep the clear acrylic stable. (There is actually fingers)


This is a draft for the code for the motion sensor using only 1 LED.

const int trigPin = 9; const int echoPin = 10; const int led = 13; // defines variables long duration; int distance; int safetyDistance; void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input pinMode(led, OUTPUT); Serial.begin(9600); // Starts the serial communication } void loop() { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; safetyDistance = distance; if (safetyDistance <= 20){ digitalWrite(led, HIGH); } else{ digitalWrite(led, LOW); } // Prints the distance on the Serial Monitor Serial.print("Distance: "); Serial.println(distance); delay(400); }

Lazer cutting my box:

I used white 3mm acyrlic to make my box.


For the 3D printed component, I made 2 triangle tabs with a rectangle protrusion. This acts as a barrier to prevent the clear acrylic from moving around too much.


Using hot glue, I glued the two tabs onto the top piece of my box to secure them together.


After putting together part of my box with chloroform, I then wired it up. I used a smaller breadboard and Andrino board to allow all the components to fit inside. Although it was quite a crammed fit, I managed to be able to fit everything including the clear acrylic.

One improvement I can make is to put the motion sensor further towards the middle to give more space between the distribution of the wires.


After updating the safety distance of the code and adding the 6 LEDs, this is my final code:

#include #ifdef _AVR_ #include // Required for 16 MHz Adafruit Trinket #endif #define PIN 13 #define NUMPIXELS 6 // Popular NeoPixel ring size Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); const int trigPin = 9; const int echoPin = 10; // defines variables long duration; int distance; int safetyDistance; void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input Serial.begin(9600); // Starts the serial communication pixels.begin(); } void loop() { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; safetyDistance = distance; if (safetyDistance <= 20){ uint32_t red= pixels.Color(255, 0, 0); pixels.fill(red, 0); pixels.show(); } else{ uint32_t magenta = pixels.Color(255, 0, 255); pixels.fill(magenta, 0); pixels.show(); } }

This is what the completed mood lamp looks like.

This is my link to my 1 minute youtube video: https://youtu.be/z0GIRwhJl6E